package com.chenye.scheduled;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by chenye on 2018/10/6.
 */
@org.springframework.web.bind.annotation.ControllerAdvice
public class ControllerAdvice {

    @ExceptionHandler(ThreadPoolRejException.class)
    @ResponseStatus(HttpStatus.EXPECTATION_FAILED)
    @ResponseBody
    public String rejExceptionHandle(HttpServletRequest request, Exception ex){
        return "任务提交失败请稍后重试！ 当前任务号："+request.getParameter("orderId");
    }
}
